package cn.eonshine.cuba.inf.modular.sys.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import cn.eonshine.base.core.datascope.DataScope;
import cn.eonshine.cuba.inf.modular.sys.entity.User;

/**
 * <p>
 * 管理员表 Mapper 接口
 * </p>
 *
 * @author stylefeng
 * @since 2017-07-11
 */
public interface UserMapper extends BaseMapper<User> {

	/**
	 * 修改用户状态
	 * 
	 * @param userId user primary key
	 * @param status  user status
	 * @return 0-false; 1-true
	 */
    public int setStatus(@Param("userId") Integer userId, @Param("status") int status);

    /**
     * 修改密码
     * 
     * @param userId user primary key
     * @param pwd password
     * @return 0-false; 1-true
     */
    public int changePwd(@Param("userId") Integer userId, @Param("pwd") String pwd);

    /**
     * 根据条件查询用户列表
     * 
     * @param dataScope data scope in company
     * @param name user name
     * @param beginTime begin time
     * @param endTime  end time
     * @param deptid company primary key
     * @return User List
     */
    public List<Map<String, Object>> selectUsers(@Param("dataScope") DataScope dataScope, @Param("name") String name, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("deptid") Integer deptid);

    /**
     * 设置用户的角色
     * 
     * @param userId userId user primary key
     * @param roleIds user role primary keys
     * @return 0-false 1-true
     */
    public int setRoles(@Param("userId") Integer userId, @Param("roleIds") String roleIds);

    /**
     * 通过账号获取用户
     * 
     * @param account user account
     * @return  User Object
     */
    public User getByAccount(@Param("account") String account);
    
}